home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 11
/
Cream of the Crop 11-1.iso
/
comm
/
ytsg3.zip
/
YTSG.DOC
< prev
next >
Wrap
Text File
|
1996-02-01
|
8KB
|
224 lines
YTSG and YTSGDOS
ytsg.c - Convert Yarn files to SOUP offline reader format using grep
syntax to select messages.
Copyright (C) 1995, Richard Curry Consulting: trindflo@fishnet.net All
Rights Reserved
My software is generally available as free software under the terms of
the GNU General Public License.
Parts of this software were copied from source code made available as
part of IBM's Developer's Connection. IBM copyright information has been
retained in the source.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with the source code to this program in a file name 'COPYING'; if not,
write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
02139, USA.
SUMMARY:
This file contains the code to translate/copy Yarn news files into
soup offline reader format. This initially is intended to allow
cleanup of a corrupted Yarn newsbase.
The original program was designed for use with the IBM CSET/2
compiler. Parts have been removed and generally performance was
degraded to conform with a DOS environment.
Usage:
ytsg [-vio] {Pattern | -e Pattern | -f StringFile} [YarnFile]
Flags:
-e Pattern Specifies a pattern.
-f StringFile Specifies a file that contains strings to be matched.
-i Ignores the case of letters when making comparisons.
-o Output the offset of each msg as found
-v Displays all lines except those that match pattern.
-y Ignore case of letters when making comparisons.
The ytsg command searches the input file specified by the *YarnFile*
parameter (standard input by default) for news/mail messages matching a
pattern.
The ytsg command searches specifically for *Pattern* parameters that are
fixed strings. Note they are not regular expressions, just fixed
strings! A real regular expression parser here might be nice, but for
now it is not to be. I have added one special case here: a single
string of * will cause all messages to be selected.
Example:
ytsg * 19226
The ytsg command outputs the message containing the matched line to soup
formatted files. The pattern that you are matching must be in the first
50,000 bytes of the article (for DOS or the first 64K for OS/2).
In addition, the string 'Newsgroups:' is searched for. This line is
searched for strings which already exist in your newsrc file. If no
Newsgroups string is found, the message is formatted into email format.
If no string in your newsrc file matches the Newsgroups string, then the
message is identified as belonging to the first group named in the
Newsgroups line. This search will recognize and ignore the
'X-Newsgroups' line added by Yarn version .85.
The exit values of this command are:
0 A match was found
1 No match was found
2 A syntax error was found or a file was inaccessible (even if matches were
found).
Flags:
-e Pattern Specifies a pattern. This works the same as a simple
pattern, but is useful when a pattern begins with a -.
-f StringFile Specifies a file that contains strings to be matched.
(The file may specify up to 256 strings in this
implementation).
-i Ignores the case of letters when making comparisons.
-o Outputs the HEX offset of each message. First message is
at offset 0.
-v Output all messages except those that match the specified
pattern.
SETUP:
With thanks to several Yarn users who have BETA tested and suggested
improvements for this software.
You need to have your HOME environment variable set. The program uses
this to locate your newsrc file.
You need to have a newsrc file. It can be an empty file, but you should
probably use the one you had. I use the the newsrc file to group the
messages into groups that you probably want to see. If I don't know
which what groups you use, I just go with the first thing on the
Newsgroups line of the message. So you will end up seeing strange
newsgroups which you never subscribed to appear in Yarn because of
cross-posting. I don't use any of the numeric information in the newsrc
file, but I do pay attention to the ':' and '!' marks.
Certain errors will crash ytsg after the AREAS file has already been
created. As a safety mechanism, ytsg will always terminate if an AREAS
file already exists in the directory. If the AREAS file resulted from a
a crashed or terminated run, just delete the AREAS file.
USES:
As stated earlier, this program was initially intended to allow cleanup
of a corrupted Yarn newsbase. All of the files in the %YARN%\news
directories are converted back into SOUP files and the whole lot is
imported into a fresh copy of Yarn. The 'Grep' or search capability was
later added and allows limited filtering of a newsbase: this has been
used to manipulate pseudo-newsgroups created with the "newgroup" command
for email filtering.
INBOX and folder files can also be processed by ytsg with a warning:
they will go back to whatever groups they originated from. This means a
message in a folder which originally was part of a newsgroup will be
imported into that newsgroup. A message without a Newsgroups: line will
be imported into email -- this includes email messages 'filtered' by
Yarn into pseudo-newsgroups even if the message contains a Newgroups:
line.
Search strings have been added allowing the tool to be used to split
newsbases based on strings in the messages.
A DOS version was added.
A bug was fixed when the string "Newsgroups:" occurred in the body of a
message.
A bug was fixed so that strings like "X-Newsgroups:" (added in Yarn
version .85) would be ignored: in previous versions of ytsg messages
containing these lines would be erroneously identified as usenet news
messages instead of email which they actually are.
EXAMPLES:
Full rebuild:
This software is fully tested and nothing can go wrong. So first we
make a copy...
SET YARN=H:\OLDYARN
SET HOME=H:\OLDYARN\RRC
cd %YARN%\news
for %c in (*) do makesoup %c
SET YARN=H:\newYARN
SET HOME=H:\newYARN\RRC
clearall
makegps
for %c in (H:\OLDYARN\news*.zip) do import %c
- Finis -
Refilter INBOX (filenames need to be shortened for DOS)
SET YARN=H:\YARN
SET HOME=H:\YARN\RRC
cd %HOME%\mail
copy INBOX INBOX.sav
makesoup INBOX
cd %YARN%
import %HOME%\mail\newsINBOX.zip
- Finis -
-Begin makesoup.cmd (or .bat -- note the filenames can get too long for DOS) --
ytsg * %1
zip -m news%1.zip AREAS *.MSG
rem same line for pkzip
erase %1
-End -- Cut -------------------------------------------------------------------
-Begin clearall.cmd (I think this works in a .bat)-----------------------------
cd %YARN%
del history.*
del supersed.*
del active
del overview
del news
cd %HOME%\yarn
del readart.*
del newsrc
-End -- Cut -------------------------------------------------------------------
-Begin makegps.cmd (only a small excerpt. mine has over 200 lines.) ----------
newgroup junk 14
newgroup list.yarn 9999 9999 yarn-list@lists.colorado.edu
newgroup rain.local.general 9999
newgroup rain.local.rain-l 9999
newgroup rain.local.help 9999
newgroup tri.politics 9999
newgroup tri.politics.sb 9999
-End -- Cut -------------------------------------------------------------------